import java.util.Arrays;

public class Solution273 {
    boolean flag=true;
    String[] words=new String[]{"Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine"};
    String[] wordsty=new String[]{"","","Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety"};
    String[] wordsteen=new String[]{"Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"};
    public String numberToWords(int num) {
        if (num==0){
            return "Zero";
        }
        flag=true;
        int[] digits=new int[20];
        Arrays.fill(digits,0);
        int length=0;
        while (num>0){
            digits[length]=num%10;
            num=num/10;
            length++;
        }
        StringBuilder stringBuilder=new StringBuilder();
        if (digits[9]!=0){
            insert(stringBuilder,words[digits[9]]);
            insert(stringBuilder,"Billion");
        }
        if (digits[8]!=0||digits[7]!=0||digits[6]!=0) {
            howMany(digits[8], digits[7], digits[6], stringBuilder);
            insert(stringBuilder, "Million");
        }
        if (digits[5]!=0||digits[4]!=0||digits[3]!=0){
            howMany(digits[5],digits[4],digits[3],stringBuilder);
            insert(stringBuilder,"Thousand");
        }
        if (digits[2]!=0||digits[1]!=0||digits[0]!=0){
            howMany(digits[2],digits[1],digits[0],stringBuilder);
        }
        return stringBuilder.toString();
    }
    void insert(StringBuilder stringBuilder,String s){
        if (flag==false){
            stringBuilder.append(' ');
        }
        stringBuilder.append(s);
        if (flag==true){
            flag=false;
        }
    }
    void howMany(int a,int b,int c,StringBuilder stringBuilder) {
        if (a != 0) {
            insert(stringBuilder, words[a]);
            insert(stringBuilder, "Hundred");
        }
        if (b != 0) {
            if (b != 1) {
                insert(stringBuilder, wordsty[b]);
            } else {
                insert(stringBuilder, wordsteen[c]);
                return;
            }
        }
        if (c!=0){
            insert(stringBuilder,words[c]);
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution273().numberToWords(2147483647));
    }
}
